package com.xindaoapp.happypet.api;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.xindaoapp.happypet.XDHttpClient;
import com.xindaoapp.happypet.utils.CommonLog;

public class AddClient {
    protected static CommonLog log = new CommonLog();

    // public static AsyncHttpClient client = new AsyncHttpClient();

    public static AsyncHttpClient getClient() {
        return XDHttpClient.client;
    }

    public static void get(String url, RequestParams params,
            AsyncHttpResponseHandler responseHandler) {
        if (ConstantsValue.cookieStore != null) {
            XDHttpClient.client.setCookieStore(ConstantsValue.cookieStore);
        }
        XDHttpClient.client.get(url, params, responseHandler);
    }

    public static void post(String url, RequestParams params,
            AsyncHttpResponseHandler responseHandler) {
        log.i(url);
        if (ConstantsValue.cookieStore != null) {
            XDHttpClient.client.setCookieStore(ConstantsValue.cookieStore);
        }
        XDHttpClient.client.post(url, params, responseHandler);

    }

}
